package com.m3958.firstgwt.client.datasource;
import com.google.inject.Inject;
import com.google.inject.Singleton;
import com.m3958.firstgwt.shared.type.CommonField;
import com.m3958.firstgwt.shared.type.VoteTplField;
import com.smartgwt.client.data.fields.DataSourceBooleanField;
import com.smartgwt.client.data.fields.DataSourceTextField;

@Singleton
public class VoteTplDataSource extends BaseDataSource{

    public static String className = "com.m3958.firstgwt.server.model.VoteTpl";
    
    @Inject
    public VoteTplDataSource(DsErrorHandler deh) {
    	setID("voteTplDS");
    	
    	DataSourceBooleanField openSourceField = new DataSourceBooleanField(VoteTplField.OPENSOURCE.getEname(),VoteTplField.OPENSOURCE.getCname());
    	DataSourceBooleanField freeField = new DataSourceBooleanField(VoteTplField.FREE.getEname(),VoteTplField.FREE.getCname());
    	DataSourceTextField tplLangField = new DataSourceTextField(VoteTplField.LANG.getEname(),VoteTplField.LANG.getCname());
    	DataSourceTextField nameField = new DataSourceTextField(CommonField.NAME.getEname(),CommonField.NAME.getCname());
    	DataSourceTextField typeField = new DataSourceTextField(VoteTplField.TYPE.getEname(),VoteTplField.TYPE.getCname());
    	DataSourceTextField dspTypeField = new DataSourceTextField(VoteTplField.DSP_TYPE.getEname(),VoteTplField.DSP_TYPE.getCname());
    	DataSourceTextField flagField = new DataSourceTextField(VoteTplField.FLAG.getEname(),VoteTplField.FLAG.getCname());
    	
        DataSourceTextField contentField = new DataSourceTextField(VoteTplField.CONTENT.getEname(),VoteTplField.CONTENT.getCname());
        
        DataSourceTextField usageField = new DataSourceTextField(VoteTplField.TPL_USAGE.getEname(),VoteTplField.TPL_USAGE.getCname());
        DataSourceTextField outScriptField = new DataSourceTextField(VoteTplField.OUT_SCRIPT.getEname(),VoteTplField.OUT_SCRIPT.getCname());
        DataSourceTextField previewUrlField = new DataSourceTextField(VoteTplField.PREVIEW_URL.getEname(),VoteTplField.PREVIEW_URL.getCname());
        addHandleErrorHandler(deh);
        
        setFields(getIdField(),getVersionField(),nameField,openSourceField,freeField,tplLangField,typeField,dspTypeField,flagField,usageField,outScriptField,previewUrlField,contentField,getCreatedAtField(false));
        setClientOnly(false);
       
    }

	@Override
	protected String getModelClassName() {
		return className;
	}
    
}
